<template>
	<view class="payDetails">
		<!-- <view class="payDetails-wallet">
			<view class="sum">{{wallet.tk}}</view>
			<view class="money">≈{{wallet.tk * 0.01}}USTD</view>
		</view> -->
		<w-all :active="active"></w-all>
		<view class="payDetails-btn van-hairline--top">
			<view class="btn-l bg1" hover-class="btn-hover" @click="goTransfer">
				转账
			</view>
			<view class="btn-r bg2" hover-class="btn-hover" @click="goCollection">
				收款
			</view>
		</view>
	</view>
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
import WAll from './all.vue'
export default {
	components: {
		WAll
	},
	data() {
		return {
			active: 0,
			lastActive: 0,
			scrollTop: {
				top1: 0,
				top2: 0,
				top3: 0,
				top4: 0
			}
		};
	},
	onLoad(option) {
	},
	computed: {
		...mapGetters({
			wallet: 'getWalletInfo'
		})
	},
	onPullDownRefresh() {
		setTimeout(function () {
			uni.stopPullDownRefresh();
		}, 1000);
	},
	methods: {
		onChangeTab (e) {
			this.lastActive = this.active
			this.active = e.detail.index;
			uni.createSelectorQuery().selectViewport().scrollOffset(res => {
			  this.scrollTop['top'+this.lastActive] = res.scrollTop
			}).exec();
			uni.pageScrollTo({
				scrollTop: this.scrollTop['top'+this.active],
				duration: 0
			})
		},
		goCollection () {
			uni.navigateTo({
				url: '/pages/wallet/collection/index'
			});
		},
		goTransfer () {
			uni.navigateTo({
				url: '/pages/wallet/transfer/index'
			});
		}
	}
};
</script>

<style scoped lang="scss">
	@import '../../../../common/details.scss'
</style>
